package org.mixed.core.resource.storage;

import lombok.Getter;
import lombok.Setter;
import org.mixed.core.resource.ResourceStorage;
import org.mixed.core.resource.info.ApiInfo;
import org.mixed.core.utils.PathUtils;
import org.mixed.service.MixResourceService;

import java.util.Objects;

@Getter
@Setter
public class ApiInfoResourceStorage implements ResourceStorage<ApiInfo> {
    private final String prefix;
    private MixResourceService resourceService;

    public ApiInfoResourceStorage(String prefix) {
        this.prefix = prefix;
    }

    @Override
    public String folder() {
        return "api";
    }

    @Override
    public String suffix() {
        return ".ms";
    }

    @Override
    public Class<ApiInfo> infoClass() {
        return ApiInfo.class;
    }

    @Override
    public void validate(ApiInfo info) {
        ResourceStorage.super.validate(info);
        notBlank(info.getMethod(), REQUEST_METHOD_REQUIRED);
    }
}
